/*
 *  ekk_decoder_subtitle_file.h
 *  EKK_Player_Lib
 *
 *  Created by hsh on 11-8-22.
 *  Copyright 2011xunlei. All rights reserved.
 *
 */

#ifndef EKK_DECODER_SUBTITLE_FILE_20101213
#define EKK_DECODER_SUBTITLE_FILE_20101213
#include "ekk_interface.h"
#ifdef __cplusplus
extern "C"{
#endif

#include "ekk_interface.h"
	






	
#if EKK_ENABLE_SUBTITLE
//void set_subtitle_start_result_func(process_subtitle_start_result_func_ptr func);

int ekk_subtitle_init();
int ekk_subtitle_uninit();
void ekk_subtitle_close(SUBTITLE_HANDLE hd);
void ekk_subtitle_set_text_attribute(SUBTITLE_HANDLE hd,SUBTITLE_TEXT_ATTRIBUTE* ptext);
ekk_bool ekk_get_subtitle_url_from_net(char* pmoiveurl,char* purl);
EKK_SUBTITLE_MARK ekk_subtitle_get_buffer_at_time(SUBTITLE_HANDLE hd,long long timestamp,unsigned char** buf);
EKK_SUBTITLE_MARK ekk_subtitle_get_text_at_time(SUBTITLE_HANDLE hd,long long timestamp,unsigned char** buf);
int ekk_subtitle_load_from_out_file(SUBTITLE_HANDLE hd,char* path,char* format);
int ekk_subtitle_upload_file(char* filmpath,char* subtitlepath);
//int ekk_subtitle_seek_at_time(long long timestamp);
SUBTITLE_HANDLE ekk_subtitle_load_by_path(int net,char* path, void *xmp_player, process_subtitle_start_result_func_ptr func, SUBTITLE_HANDLE *subtitle_handle);//net = 0 is local file ,net = 1,path is the net math back subtitle
void ekk_subtitle_cancel_load_by_path();
	
//auto match subtitle file
int ekk_subtitle_find_match_file(char* path, void *xmp_player, process_subtitle_get_match_path_func_ptr func);
//cancel finding process, once cancelled, func callback will not be called!
void ekk_subtitle_cancel_find_match_file();
//int ekk_subtitle_get_match_path(SUBTITLE_MATCH_CONTEXT** pcontext);

#else /*#if EKK_ENABLE_SUBTITLE*/
//#define set_subtitle_start_result_func(func)
#define ekk_subtitle_init()
#define ekk_subtitle_uninit()
#define ekk_subtitle_close(hd)
#define ekk_subtitle_set_text_attribute(hd,ptext)
#define ekk_get_subtitle_url_from_net(pmoiveurl,purl)
#define ekk_subtitle_get_buffer_at_time(hd,timestamp,buf)  (_SUBTITLE_NO_CONTENT)
#define ekk_subtitle_get_text_at_time(hd,ts,buf)    (_SUBTITLE_NO_CONTENT)
#define ekk_subtitle_load_from_out_file(hd,path,format)
#define ekk_subtitle_upload_file(filmpath,subtitlepath)
#define ekk_subtitle_load_by_path(net,path,player,func,hd)
#define ekk_subtitle_cancel_load_by_path()
#define ekk_subtitle_find_match_file(path,player,func)
#define ekk_subtitle_cancel_find_match_file()
#endif /*#if EKK_ENABLE_SUBTITLE*/	

#ifdef __cplusplus
}
#endif
#endif